using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;  
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class E1CityMap : EntityTypeConfiguration<E1City>
    {
        public E1CityMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.CityName)
                .HasMaxLength(50);

            this.Property(t => t.CityCode)
                .HasMaxLength(10);

            this.Property(t => t.CityCountry)
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("E1City");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.CityName).HasColumnName("CityName");
            this.Property(t => t.CityCode).HasColumnName("CityCode");
            this.Property(t => t.CityCountry).HasColumnName("CityCountry");
            this.Property(t => t.Blurb).HasColumnName("Blurb");
        }
    }
}
